﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Conqueror.WP.Helpers
{
    public static class ScreenHelper
    {
        private static float margin = 12;
        public static float Margin { get { return margin; } }
        private static int tileHorizontalNumber = 3;
        public static int TileHorizontalNumber { get { return tileHorizontalNumber; } }

        public static double CalculateFullTileSize()
        {
            return (double)(Application.Current.Host.Content.ActualWidth - (margin * (tileHorizontalNumber - 1 + 2))) / tileHorizontalNumber;
        }

        public static double CalculateHalfTileSize()
        {
            return (CalculateFullTileSize() - margin) / 2;
        }

        internal static double CalculateRemainingSize(int full, int half, bool includeOuterMargins)
        {
            int margins = (includeOuterMargins ? 2 : 0) + (full + half);
            double fullSize = CalculateFullTileSize();
            double halfSize = CalculateHalfTileSize();

            double used = (margins * margin + fullSize * full + halfSize * half);
            return Application.Current.Host.Content.ActualHeight - used;
        }
    }
}
